<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			console.clear()
			let arr1 = ['xiaoye','xiaolong']
			let arr2 = ['xiaohei',...arr1,'xiaomei']
			console.log("三点连接==》",arr2);
			/**
			 * 参数解构
			 * @param {Object} x
			 * @param {Object} y
			 * @param {Object} z
			 */
			function f(x,y,z){return x+y+z}
			console.log("参数解构==》",f(...arr2));
			
			function ff(x,y,z){return x+y+z}
			console.log(f(...arr2));
			
			/**
			 * 数组解构
			 * 
			 */
			let objarr = ["xiaoye",20,2000]
			// let [name,age] = objarr
			// console.log(name,age);
			
			let objarr4 = ['xiaohei',20,4545]
			let [name_v,age_v,price_v] = objarr4
			console.log("数组解构2=》",name_v,age_v,price_v);
			
			const [name,age=19,price=0.1] = objarr
			console.log("4",name,age,price); 
			let [n_v,a_v,p_v,c_v = "小龙"] = objarr4
			console.log(c_v);
			
			/**
			 * 对象解构
			 */
			let obj = {name_b:"xiaoye",age_b:20,price_b:2340}
			let {name_b:name_c,age_b:age_c,price_b:price_c} = obj
			
			console.log("对象解构==》",name_c,age_c,price_c);
			
			
			var obj2 = {
				name:"xiaoyex",
				list:[
					{
						shopname:"西瓜",
						price:20
					},
					{
						shopname:"苹果",
						price:200
					}
				]
			}
			
			let {name:n1,list:[{shopname:ss1},{shopname:ss2,price:p2}]} = obj2
			console.log("价格=",p2);
			
			
			
			let {name:shopnamebase,list:[{shopname:s1},{shopname:s2}]} = obj2
			console.log(shopnamebase,s1,s2);
		</script>
	</body>
</html>
